<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-on</title>
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<div id="app">

    <input type="button" value="v-on指令" v-on:click="doIt">
    <input type="button" value="v-on指令" @click="doIt">
    <input type="button" value="双击指令" @dblclick="doIt">
    <h2 @click="changefood">{{food}}</h2>
</div>

<script>
    var app = new Vue({
        el:"#app",
        data:{
            food:"西红柿炒鸡蛋"
        },
        methods:{
         doIt:function () {
           alert("JohnWick");
         },
         changefood:function () {
             // console.log(this.food);
             this.food+="好好吃"
         }
        },
    })
</script>
</body>
</html>
